package cn.com.dcsgo.controller;

import cn.com.dcsgo.domain.dto.AfterSaleReplySaveDTO;
import cn.com.dcsgo.domain.result.Result;
import cn.com.dcsgo.domain.vo.AfterSaleReplyDetailVO;
import cn.com.dcsgo.service.AfterSaleReplyService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.List;

/**
 * AfterSaleReplyController
 *
 * @author Dcsgo
 * @since 19/5/2025 上午 11:02
 */
@Slf4j
@CrossOrigin
@RestController
@RequestMapping("after-sale/reply")
@RequiredArgsConstructor
public class AfterSaleReplyController {
    private final AfterSaleReplyService afterSaleReplyService;

    @PostMapping
    public Result<Serializable> add(@RequestBody AfterSaleReplySaveDTO afterSaleReplySaveDTO) {
        afterSaleReplyService.save(afterSaleReplySaveDTO);
        return Result.ok();
    }

    @GetMapping("service/{afterSaleId}")
    public Result<List<AfterSaleReplyDetailVO>> get(@PathVariable Long afterSaleId) {
        return Result.ok(afterSaleReplyService.list(afterSaleId));
    }
}
